package com.library.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;

import books.borrowing.entity.SubscriberEntity;

import com.library.admin.service.LibraryService;
import com.vaadin.Application;
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.Window;

@Configurable
public class AdmLibrary extends Application {
    private static final long serialVersionUID = 1L;

    public static final String APPLICATION_TITLE = "AdmLibrary";

    private Window mainWindow;
    private CustomLayout customLayout;
    @Autowired
    private Menu menu;
    @Autowired
    private MainPanel mainPanel;
    @Autowired
    private LibraryService libraryService;
    private SubscriberEntity connectedUser;

    @Override
    public void init() {
    	mainWindow = new Window("AdmLibrary");
    	customLayout = new CustomLayout("my-layout");
    	
    	customLayout.addComponent(menu, "menu");
    	customLayout.addComponent(mainPanel, "mainPanel");
    	
    	mainWindow.setContent(customLayout);
    	
    	setTheme("mytheme");
        setMainWindow(mainWindow);
    }

	public Menu getMenu() {
		return menu;
	}

	public MainPanel getMainPanel() {
		return mainPanel;
	}

	public SubscriberEntity getConnectedUser() {
		return connectedUser;
	}

	public void setConnectedUser(SubscriberEntity connectedUser) {
		this.connectedUser = connectedUser;
	}

	public LibraryService getLibraryService() {
		return libraryService;
	}
}
